#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(RoleEntity))]
public class RoleEntityInspector : Editor
{
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        RoleEntity _this = target as RoleEntity;
        
        _this.playerId = EditorGUILayout.IntField("playerId", _this.playerId);
        
        if (Application.isPlaying && _this)
        {
            EditorGUILayout.TextField("name", _this.name);
            EditorGUILayout.IntField("hp", _this.hp);
            EditorGUILayout.FloatField("当前移动速度", _this.curMoveSpeed); 
            //EditorGUILayout.Toggle("in stay", _this.inStay);
          
            if (_this.curAction != null)
            {
                EditorGUILayout.TextField("cur Action", _this.curAction?.GetType().Name);

                if (_this.curAction.transitions != null)
                {
                    EditorGUILayout.TextField("action child count", _this.curAction?.transitions?.Count.ToString());

                    for (int i = 0; i < _this.curAction.transitions.Count; i++)
                    {
                        EditorGUILayout.TextField($"child {i}",
                            (_this.curAction.transitions[i].toState)?.GetType().Name);
                    }
                }
            }
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
}

#endif